Heading issues

Hi all,
In some modules that were imported to DOORS have a problem with the heading, instead of being a heading, it looks like a text. So I need to do a script or any other solution to correct this.
I tried with this code and works fine but I can not ignore the object heading number:

pragma runLim, 0

Module m = current Module
Object objMod
string conType, objText

 

for objMod in m do {
conType = objMod."HB_ContentType"
if(conType == "Req Heading"){
objText = richText(objMod."Object Text")
objMod."Object Heading" = richText(objText)
objMod."Object Text" = null
}
}

Thanks in advance for your support.

 


BrianAguilar - Wed Sep 19 17:16:03 EDT 2018

Re: Heading issues
Mike.Scharnow - Thu Sep 20 03:29:59 EDT 2018

what exactly is your problem? Is it that the Heading begins with "1 " or is it that there is a chapter 1 which is not the introduction?

In the former case, you might use a regular expression that removes "<one or more numbers at the beginning of the string followed by a blank>", hoping that you don't delete important information.

In the latter case, review your source document (assuming you imported from MS Word): check for the "outline level" of paragraphs. This level corresponds to the level used in DOORS. Problems in the outline level can easily be seen in the overview navigation of MS Word. Correct these levels and import the documents again.  Note that in DOORS you will not be able to have objects with a lesser object number than "1", so, if you have objects before your "introduction" you will possibly need to delete them from the document / module.

Re: Heading issues
davidcs - Thu Sep 20 13:33:54 EDT 2018

If all you are looking to do is strip off the leading numbers that were imported a regex is probably your best bet. Something like this should work...

Regexp lHeading = regexp2 "[0-9]* *(.*)"
string lTestStr  = "1334 Hello World Heading"

if(lHeading lTestStr){
  print lTestStr[match 1] "\n"
}

Re: Heading issues
Bill_B. - Mon Sep 24 12:57:31 EDT 2018

I think the issue he is having is that the data that was imported got brought in as TEXT and not HEADING style...thus the heading "Introduction" was not auto-numbered by DOORS as "1 Introduction" in the Object Heading Attribute, but came in as "1 Introduction" in the Object Text Attribute...so he needs to move the data from text to heading and strip the "1"...

Re: Heading issues
BrianAguilar - Tue Sep 25 13:24:21 EDT 2018

Bill_B. - Mon Sep 24 12:57:31 EDT 2018

I think the issue he is having is that the data that was imported got brought in as TEXT and not HEADING style...thus the heading "Introduction" was not auto-numbered by DOORS as "1 Introduction" in the Object Heading Attribute, but came in as "1 Introduction" in the Object Text Attribute...so he needs to move the data from text to heading and strip the "1"...

Thank you @Bill_B. cfdd7b59-f31a-40bc-95b8-7a9c52379479 Finally I can did it.

Re: Heading issues
BrianAguilar - Tue Sep 25 13:26:36 EDT 2018

davidcs - Thu Sep 20 13:33:54 EDT 2018

If all you are looking to do is strip off the leading numbers that were imported a regex is probably your best bet. Something like this should work...

Regexp lHeading = regexp2 "[0-9]* *(.*)"
string lTestStr  = "1334 Hello World Heading"

if(lHeading lTestStr){
  print lTestStr[match 1] "\n"
}

Thanks @davidcs I could do it by implementing a for loop.

Re: Heading issues
BrianAguilar - Tue Sep 25 13:27:01 EDT 2018

Mike.Scharnow - Thu Sep 20 03:29:59 EDT 2018

what exactly is your problem? Is it that the Heading begins with "1 " or is it that there is a chapter 1 which is not the introduction?

In the former case, you might use a regular expression that removes "<one or more numbers at the beginning of the string followed by a blank>", hoping that you don't delete important information.

In the latter case, review your source document (assuming you imported from MS Word): check for the "outline level" of paragraphs. This level corresponds to the level used in DOORS. Problems in the outline level can easily be seen in the overview navigation of MS Word. Correct these levels and import the documents again.  Note that in DOORS you will not be able to have objects with a lesser object number than "1", so, if you have objects before your "introduction" you will possibly need to delete them from the document / module.

Thank you!!